<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>资源管理</title>
		[#include "/html/include/easyuicss.html" /]
		[#include "/html/include/easyuijs.html" /]
	</head>
	<body class="easyui-layout" data-options="fit:true">

		<form id="permitForm" class="easyui-form" method="post" data-options="novalidate:true">
			<input type="hidden" name="method" value="${RequestParameters['method']}" />
			<input type="hidden" name="permitId" value="${permit.permit_id}" />
			<input type="hidden" name="moduleId" value="${module.module_id}" />
			<table class="tblEidt">
				<tr>
					<td class="tdText">
						资源名称<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="permitName" data-options="required:true" value="${permit.permit_name}" />
					</td>
					<td class="tdText">
						归属模块<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="moduleName" readonly data-options="required:true" value="${module.module_name}" />
					</td>
				</tr>
				<tr>
					<td class="tdText">
						资源链接<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="permitUrl" data-options="required:true" value="${permit.permit_url}" />
					</td>
					<td class="tdText">
						资源代码<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="permitCode" data-options="required:true,validateOnCreate:false" validType="remote['${app}/sysmgr/module/checkCode.do?id=${permit.permit_id}','code']" invalidMessage="代码已存在" value="${permit.permit_code}" />
					</td>
				</tr>
			</table>
			<div class="edit-btn-group">
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-ok'" style="width:80px"
				   onclick="savePermit(this);">保存</a>
				&nbsp;&nbsp;
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-cancel'" style="width:80px"
				   onclick="closeWindow();">关闭</a>
			</div>
		</form>
	</body>
    <script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		function closeWindow(){
			parent.layer.close(index);
		}
		function savePermit(obj){
			$(obj).linkbutton('disable');
			$('#permitForm').form('submit', {
				url: '${app}/sysmgr/permit/save.do',
				onSubmit: function () {
					var valid = $(this).form('enableValidation').form('validate');
					if (!valid) {
						$(obj).linkbutton('enable');
					}
					return valid;
				},
				success: function (data) {
					var result = $.parseJSON(data);
					parent.easyui.msgShow('系统提醒', result.msg, 3000, 250, 100);
					$(obj).linkbutton('enable');
					if (result.result == 1) {
						parent.layer.close(index);
						parent.frames[parent.iframeName].window.reloadPermit();
					}
				}
			});
		}
    </script>
</html>